package com.joysuch.wwyt.datadump.biz.convertor;

import cn.zlg.common.datadump.annotation.DataDumpField;
import cn.zlg.common.datadump.convertor.FieldValueConvert;
import net.sf.ehcache.search.parser.MValue;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

@Component
public class ImportMhPointConvertor implements FieldValueConvert<String, Integer> {

    @Override
    public Integer convert(Object bean, String value, DataDumpField dataField) {
        if (StringUtils.isNotBlank(value)&&value.equals("关闭")){
            return 0;
        }else if(StringUtils.isBlank(value)||value.equals("开启")) {
            return 1;
        }else {
           throw new IllegalArgumentException("请填写开启或关闭") ;
        }

    }
}
